import 'package:flutter/material.dart';
import 'package:nav_example/page2.dart';
import 'main.dart';

class Page1 extends StatefulWidget {
  @override
  Page1State createState() => Page1State();
}

class Page1State extends State<Page1> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Container(
        child: FlatButton(
          child: Text('从跟页面发起push'),
          onPressed: _push,
        ),
      ),
    );
  }

  void _push() {
    Navigator.of(globalCtx)
        .push(MaterialPageRoute(builder: (BuildContext context) {
      return Page2();
    }));
  }
}
